package top.frsf;

import java.awt.*;

/**
 * @BelongsProject: TankWar1
 * @BelongsPackage: top.frsf
 * @Author: FRSF
 * @CreateTime: 2022-09-03  09:56
 * @Description: 游戏元素抽象父类
 * @Version: 1.0
 */
public abstract class GameObject {
    // 图片
    public Image img;
    // 坐标
    public int x;
    public int y;
    // 所在界面
    public GamePanel gamePanel;

    public GameObject(String img, int x, int y, GamePanel gamePanel) {
        this.img = Toolkit.getDefaultToolkit().getImage(img);
        this.x = x;
        this.y = y;
        this.gamePanel = gamePanel;
    }

    // 自身绘制
    public abstract void paintSelf(Graphics g);

    // 矩形区域返回
    public abstract Rectangle getRec();
}
